# $Id$
# Maintainer: Ronald van Haren <ronald@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: damir <damir@archlinux.org>

pkgname=amarok
pkgver=2.8.0
pkgrel=15
pkgdesc="The powerful music player for KDE"
arch=("i686" "x86_64")
url="http://amarok.kde.org/"
license=('GPL2' 'LGPL2.1' 'FDL')
depends=('kdebase-runtime' 'mariadb' 'taglib-extras'
        'liblastfm' 'ffmpeg' 'libofa' 'qjson' 'qtscriptgenerator')
makedepends=('pkgconfig' 'automoc4' 'cmake' 'libgpod' 'libmtp' 'loudmouth'
             'libmygpo-qt' 'mesa' 'clamz')
optdepends=("libgpod: support for Apple iPod audio devices"
            "libmtp: support for portable media devices"
            "loudmouth: backend needed by mp3tunes for syncing"
            "ifuse: support for Apple iPod Touch and iPhone"
            "libmygpo-qt: gpodder.net Internet Service"
            "clamz: allow to download songs from Amazon.com"
            "gst-libav: MP3 codecs"
            "audiocd-kio4: audio CD support")
source=("http://download.kde.org/stable/${pkgname}/${pkgver}/src/${pkgname}-${pkgver}.tar.bz2"
        taglib_version_detect.patch amarok-ffmpeg3.patch::"https://git.reviewboard.kde.org/r/126682/diff/raw/"
        amarok-no-qtwebkit.patch amarok-plasma5.7.patch)
sha1sums=('e76ccd53c05d57f9457d74cd08c2c41383c00937'
          '8b2752a0fe78621bdb9ccdb763919ea265b52b06'
          '819cb060cd9c63b576cc433f835cb4c175b07fd0'
          '9f905eba9e5ead6d704f0cd28e389857c29dc15d'
          '9908c154bf583a1755acf59f9d2790aaff503162')

prepare() {
  mkdir build

  cd ${pkgname}-${pkgver}
  patch -Np1 -i ../taglib_version_detect.patch
# Fix build against ffmpeg 3.0
  patch -p1 -i ../amarok-ffmpeg3.patch
# Disable applets that require qtwebkit
  patch -p1 -i ../amarok-no-qtwebkit.patch
# Fix tooltips MPRIS controls in Plasma 5.7
  patch -p1 -i ../amarok-plasma5.7.patch
}

build() {
  cd build
  cmake ../${pkgname}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DKDE4_BUILD_TESTS=OFF \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DWITH_NepomukCore=OFF \
    -DWITH_Soprano=OFF
  make
}

package(){
  cd build
  make DESTDIR="${pkgdir}" install
}
